package so.sao.code.service.infrastructure.enums;

import so.sao.top.core.util.enums.NamedEnumEntity;

public enum PrintFileDownloadMethod implements NamedEnumEntity<Integer> {
	/**
	 * 发出下载链接，直接通过链接下载
	 */
	ExternalLink(1, "外链生成"),
	/**
	 * 用户登录到portal管理系统，通过页面下载
	 */
	InternalLink(2, "直接下载"),
	/**
	 * 打印设备在线下载
	 */
	OnLine(3, "在线下载");

	private Integer id;
	private String name;

	private PrintFileDownloadMethod(Integer id, String name) {
		this.id = id;
		this.name = name;
	}

	@Override
	public Integer getValue() {
		return id;
	}

	@Override
	public String getName() {
		return name;
	}

	public static PrintFileDownloadMethod fromValue(Integer id) {
		switch (id) {
		case 1:
			return ExternalLink;
		case 2:
			return InternalLink;
		case 3:
			return OnLine;
		default:
			throw new IllegalArgumentException("Value [" + id + "] not support!");
		}
	}
}
